//
//  OpMainTabBarController.m
//  LoveFreshBeeReplica
//
//  Created by skywalker on 16/12/30.
//  Copyright © 2016年 斯芬克斯. All rights reserved.
//

#import "OpMainTabBarController.h"
#import "OpMineController.h"
#import "OpShoppingCarController.h"
#import "OpHeaderPageController.h"
#import "OpFlashDeliverMarketController.h"
#import "OpBaseNavigationController.h"


@interface OpMainTabBarController ()

@end

@implementation OpMainTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self addMainTabBarControllers];
}
#pragma mark -添加MainTabBarC
-(void)addMainTabBarControllers{
    
    [self setupChildViewController:@"首页" viewController:[OpHeaderPageController new] image:@"v2_home" selectedImage:@"v2_home_r"];
    [self setupChildViewController:@"闪电超市" viewController:[OpFlashDeliverMarketController new] image:@"v2_order" selectedImage:@"v2_order_r"];
    [self setupChildViewController:@"购物车" viewController:[OpShoppingCarController new] image:@"shopCart" selectedImage:@"shopCart_r"];
    [self setupChildViewController:@"我的" viewController:[OpMineController new] image:@"v2_my" selectedImage:@"v2_my_r"];

}
#pragma mark -封装添加MainTabBarC
- (void)setupChildViewController:(NSString *)title viewController:(UIViewController *)controller image:(NSString *)image selectedImage:(NSString *)selectedImage {
    UITabBarItem *item = [[UITabBarItem alloc]init];
    item.image = [UIImage imageNamed:image];
    item.selectedImage = [UIImage imageNamed:selectedImage];
    item.title = title;
    controller.tabBarItem = item;
    controller.title = title;
    OpBaseNavigationController *navigationController = [[OpBaseNavigationController alloc]initWithRootViewController:controller];
    [self addChildViewController:navigationController];

}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
